 package com.mijie.homi.search.util; 
    import java.io.StringReader; 
    import org.apache.lucene.analysis.Analyzer; 
    import org.apache.lucene.analysis.Token; 
    import org.apache.lucene.analysis.TokenStream; 
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;

import net.paoding.analysis.analyzer.PaodingAnalyzer; 
    //测试"庖丁解牛"中文分词器的分词效果     
    public class Paodingtest { 
        public static void main(String[] args) throws Exception { 
        	
        	
            Analyzer analyzer = new PaodingAnalyzer(); 
            String  indexStr = "我的QQ号码是58472399"; 
            StringReader reader = new StringReader(indexStr); 
            TokenStream ts = analyzer.tokenStream("", reader); 
//            Token t = ts.next(); 
//            while (t != null) { 
//                System.out.print(t.termText()+"  "); 
//                t = ts.next(); 
//            } 
            
            
        	// 分词
		//	TokenStream ts = anal.tokenStream("", reader);
			CharTermAttribute term = ts.getAttribute(CharTermAttribute.class);
			// 遍历分词数据
			String rc0 = "";
			while (ts.incrementToken()) {
				// System.out.print(term.toString() + "     ");
				rc0 = rc0 + term.toString() + "|";
			}
        } 
    } 